/*
 * @Author: hfqf123@126.com
 * @Date: 2023-01-19 13:56:56
 * @LastEditors: user.email
 * @LastEditTime: 2023-01-19 15:25:00
 * @FilePath: /spemqtt/client/js/mqtt-httpposter.js
 * @Description: 该类用户发起和mqtt功能相关的http请求
 * 
 * Copyright (c) 2023 by hfqf123@126.com, All Rights Reserved. 
 */

var MQTTHttpPoster = function() {
    this.mm = '' //用户密码
    this.hostname = '' //mqtt主机 admin:port
    this.clientId = '' //
    this.qos = '' //qos
    this.qybs = ''
    this.jstopic = '' //接收topic
    this.sbtopic = '' //上报topic
    this.yhm = ''
    this.xtzq = 10 //心跳周期 单位为s
}


const http_url = {
    getDeviceId: '/lzsvr-app-ss/mqttQuery/getDeviceId', //获取登录用户基本信息
}


MQTTHttpPoster.prototype.getDeviceId = function(appid, deviceId, admin, onsuccess, onfail) {
    $.ajax({
        type: "post",
        url: (admin ? admin : 'https://msvr.lzsyr.cn') + http_url.getDeviceId,
        data: {
            appid: appid,
            deviceId: deviceId
        },
        dataType: "json",
        success: function(response) {
            onsuccess(response)
        },
        fail: function(error) {
            onfail(error)
        }
    });
}